// 手写new 构造函数
//new 实例化的过程,传入的参数1是函数，其余为参数
function _new(fun,...other) {
  // 创建一个空对象
  const obj = {}
  obj.__proto__=fun.prototype
  obj.fn = fun
  obj.fn(...other)
  newObj=fun.call(obj,...other)
  return newObj instanceof Object?newObj: obj
}

function Person(name, age) {
  this.name = name
  this.age = age
  return {age:this.age}
}

_new(Person,1,2)


// console.log(new Person(2,3))
